﻿namespace A14_Ex01_3
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    public class AdvancedMeuyanBuilder
    {
        private static int m_MeuyanSize = 0;

        public static string CreateNewAdvancedMeuyanStr()
        {
            string newMeuyanStr = A14_Ex01_2.MeuyanBuilder.CreateNewMeuyanStr(m_MeuyanSize);

            return newMeuyanStr;
        }

        public static bool ValidateSize(string i_InputMeuyanSizeStr)
        {
            
            bool isValid = false;

            while (!isValid)
            {
                isValid = int.TryParse(i_InputMeuyanSizeStr, out m_MeuyanSize);

                if (m_MeuyanSize < 0)
                {
                    isValid = false;
                }

                if (!isValid)
                {
                    System.Console.WriteLine(@"Invalid Input! Please enter a valid size of meuyan." + System.Environment.NewLine);
                    i_InputMeuyanSizeStr = System.Console.ReadLine();
                }
            }

            return isValid;
        }
    }
}
